import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class HandTest {

	@org.junit.Test
	public void testCheckIfFlush() throws Exception {
		Card card1 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.KING);
		Card card2 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.KING);
		Card card3 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.BLACK, Card.LEVELS.QUEEN);
		Card card4 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.BLACK, Card.LEVELS.JACK);
		Card card5 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.TEN);
		List<Card> cards = new ArrayList<Card>();
		cards.add(card1);
		cards.add(card2);
		cards.add(card3);
		cards.add(card4);
		cards.add(card5);

		Combination combActual = Hand.checkIfFlush(cards);


		Combination combExpected = new Combination(Combination.LEVELS.FLUSH, new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.KING));


		assertFalse("Sorry but combActual is null", combActual==null);

		assertTrue("Actual is not equal to expected: ", combActual.getLevelOfCard().equals(combExpected.getLevelOfCard()));
	}

    @org.junit.Test
    public void testCheckIsStraight() throws Exception {
        Card card1 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.KING);
        Card card2 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.QUEEN);
        Card card3 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.BLACK, Card.LEVELS.JACK);
        Card card4 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.BLACK, Card.LEVELS.TEN);
        Card card5 = new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.NINE);
        List<Card> cards = new ArrayList<Card>();
        cards.add(card1);
        cards.add(card2);
        cards.add(card3);
        cards.add(card4);
        cards.add(card5);

        Combination combinationActual = Hand.isStraight(cards);
        Combination combinationExpected = new Combination(Combination.LEVELS.STRAIGHT, new Card(Card.SUIT.DIAMOND, Card.COLOUR.RED, Card.LEVELS.KING));

        assertFalse("Sorry but combinationActual is null", combinationActual == null);
        assertTrue(combinationActual.getLevelOfCard().equals(combinationExpected.getLevelOfCard()));
    }
}
